package com.caldremch;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


/**
 * Created by Caldremch on Mac 2017/2/18 22:51.
 *
 * 测试连接数据库
 */
public class JdbcTest {

    public static void main(String[] args){


       Connection connection = null;

        try {
            Class.forName("com.mysql.jdbc.Driver");

            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/Test1?characterEncoding=utf8","root", "root");

            System.out.println("connect success = "+connection);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
